package net.framework.smc.kafka.service;

import lombok.extern.slf4j.Slf4j;
import net.framework.smc.kafka.channel.MySink;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.handler.annotation.SendTo;

@EnableBinding({MySink.class, Processor.class})
@Slf4j
public class KafkaReceiver {

//    @StreamListener(MySink.INPUT)
//    @SendTo(Processor.INPUT)
//    private void receive(String payload){
//        log.info(payload + "============================");
//    }
//
    @StreamListener(MySink.INPUT)
    @SendTo(Processor.INPUT)
    public String listen(@Payload String message){
        log.info("===================================" + message);
        return "已收接到";
    }
}
